package zhongbo.java.websocket.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * WebSocket方式 2 注解方式(简单)
 */
@Configuration
public class WebSocketConfig {

    /**
     * 注册了此Bean才能使用注解WebSocket
     */
    // 关键！注册@ServerEndpoint注解的Bean
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }
}